package com.orhon.smartcampus.modules.teacher.entity;

import java.util.Date;

import javax.persistence.*;

import com.orhon.smartcampus.modules.material.entity.Buildings;
import com.orhon.smartcampus.modules.material.entity.Floor;
import com.orhon.smartcampus.modules.material.entity.Room;
import com.orhon.smartcampus.modules.material.entity.Unit;
import com.orhon.smartcampus.modules.student.entity.SInformation;
import com.orhon.smartcampus.modules.systemctl.entity.OrgDepartments;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

@Setter
@Getter
@EqualsAndHashCode
@Entity
@Table(name = "teacher_office_arrange", schema = "smartcloud", catalog = "")
public class OfficeArrange {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    private Long id;
    @Column(name = "office_name")
    private String officeName;
//    @Column(name = "buildings_id", nullable = true)
//    private Long buildingsId;
//    @Column(name = "unit_id", nullable = true)
//    private Long unitId;
//    @Column(name = "floor_id", nullable = true)
//    private Long floorId;
//    @Column(name = "room_id", nullable = true)
//    private Long roomId;
//    @Column(name = "department_id", nullable = true)
//    private Long departmentId;
//    @Column(name = "head_user", nullable = true)
//    private Long headUser;
    @Column(name = "created_at", nullable = true)
    private Date createdAt;
    @Column(name = "created_by", nullable = true)
    private Integer createdBy;
    @Column(name = "updated_at", nullable = true)
    private Date updatedAt;
    @Column(name = "updated_by", nullable = true)
    private Integer updatedBy;
    @Column(name = "school_id", nullable = true)
    private Integer schoolId;
    @Column(name = "deleted_at", nullable = true)
    private Date deletedAt;

    @ManyToOne
    @JoinColumn(name = "buildings_id", referencedColumnName = "id")
    @Where(clause = "ISNULL(deleted_at)")
    @NotFound(action= NotFoundAction.IGNORE)
    private Buildings materialBuildingsByBuildingsId;

    @ManyToOne
    @JoinColumn(name = "unit_id", referencedColumnName = "id")
    @Where(clause = "ISNULL(deleted_at)")
    @NotFound(action= NotFoundAction.IGNORE)
    private Unit materialUnitByUnitId;

    @ManyToOne
    @JoinColumn(name = "floor_id", referencedColumnName = "id")
    @Where(clause = "ISNULL(deleted_at)")
    @NotFound(action= NotFoundAction.IGNORE)
    private Floor materialFloorByFloorId;

    @ManyToOne
    @JoinColumn(name = "room_id", referencedColumnName = "id")
    @Where(clause = "ISNULL(deleted_at)")
    @NotFound(action= NotFoundAction.IGNORE)
    private Room materialRoomByRoomId;

    @ManyToOne
    @JoinColumn(name = "department_id", referencedColumnName = "id")
    @Where(clause = "ISNULL(deleted_at)")
    @NotFound(action= NotFoundAction.IGNORE)
    private OrgDepartments systemctlOrgDepartmentsByDepartmentId;
    @ManyToOne
    @JoinColumn(name = "head_user", referencedColumnName = "id")
    @Where(clause = "ISNULL(deleted_at)")
    @NotFound(action= NotFoundAction.IGNORE)
    private TInformation teacherTInformationByHeadUser;

}
